#include "Grotto.h"
#include "ShareComponents.h"
#include "MainGame.h"
#include "GameDefine.h"
#include "Rock.h"
#include "Box.h"
#include "Camera.h"
Grotto::Grotto(Box* _box): Object(_box,MACHINE)//id la debug
{
	init();
}


Grotto::~Grotto(void)
{
}

void Grotto::init()
{
	_isAlive = true;
	delay = 0;
	_box->_size.x = 20;
	_box->_size.y = 20;
	delay = 3000;
}

void Grotto::update()
{
	if(_box->getTop() < gl_camera->getTop())
	{
		_isAlive = false;
	}
	//no ko dc query ra. c
	delay += GAME_TIME;
	if(delay > 4000)
	{
		delay = 0;
		Rock* r =new Rock(new Box(_box));
		gl_MainGame->addWorldObject(r);
	}
}

void Grotto::render()
{
	
}

Box* Grotto::getCollisionBox()
{
	return gl_BOX_0_0_0;
}
